<div class="g-bd clearfix">
    	<div class="fcj_menu clearfix">
    		<b class="spbg2 corner tl"></b>
    		<b class="spbg2 corner tr"></b>
    		<b class="spbg2 corner bl"></b>
    		<b class="spbg2 corner br"></b>
    		<div class="titlebar clearfix">You are a guest. Please choose a way to buy.</div>						
            <div class="maincontent clearfix">
	    		<div class="member clearfix">	
	    			<h2>I'm A Returning Customer</h2>
	    			<?php if ($this->error == 'loginError'):?>	
	    			<span style="float: left; color: red; font-size: 14px;">Wrong email or password!</span>	
	    			<?php endif;?>
	    			<form name="registForm" method="post" action="auth-dologin">	
	    			<ul>	
	    				<li>	
	    					<span class="title">Email:</span>	
	    					<span><input type="text" name="username" value="" /></span>	
	    				</li>	    			
	    				<li>	
	    					<span class="title">Password:</span>	
	    					<span><input type="password" name="userpass" value="" /></span>	
	    					<span>Remember, your password is case sensitive.</span>	
	    					<input type="hidden" value="/product-addcontact?coupon=<?php echo isset($_GET['coupon']) ? $_GET['coupon'] : '';?>" name="preurl" />		    					
	    				</li>	
	    				<li>	
	    					<span class="forgot"><a href="auth-forgetpass?preurl=<? $preArray=explode('=',CURRENT_URL);echo $preArray[count($preArray)-1];?>">Forgot your password?</a></span>	
	    				</li>	
	    				<li>	
	    					<span><input type="submit" value="Login" class="spbg2 login_btn" />
	    					&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="<?php echo ROOT_PATH;?>/auth<?=CHOSING_DE ?>register?preurl=/product-showitem">Register</a>
	    					</span>	
	    				</li>	    				
	    			</ul>	
	    			</form>	
	    		</div>	
	    		<div class="member notmember clearfix" style="border-right: none;">	
	    			<h2>Register as a member</h2>	
	    			<form name="registForm2" id="registForm2" method="post" action="auth-doquickregister">	
	    			<ul>	
	    				<li>	
	    					<span class="title"><font>*</font>Email:</span>	
	    					<span><input type="text" name="username" value="" /></span>	
	    				</li>	    			
	    				<li>	
	    					<span class="title"><font>*</font>Password:</span>	
	    					<span><input type="password" name="userpass" value="" /></span>		    					
	    					<input type="hidden" value="/product-addcontact?coupon=<?php echo isset($_GET['coupon']) ? $_GET['coupon'] : '';?>" name="preurl" />
	    				</li>	
	    				<li>	
	    					<span class="title"><font>*</font>Confirm Password:</span>	
	    					<span><input type="password" name="confirm_userpass" value="" /></span>
	    				</li>
	    				<li>
	    					<span class="title">Invitation code(optional):</span>
	    					<span>
	    					<input type="text" name="invite_code" value="<?php echo CMlm::getInviteCode() == 0 ? '':CMlm::getInviteCode();?>" /><span ok="ok"></span> <br /><a target="_blank" href="/mlm-index">Bring your friend and earn with us!</a> 					
	    					</span>
    					</li>	
	    				<li>	
	    				<br/>
	    				</li>
	    				<li>	
	    					<span><input type="button" value="Continue" class="spbg2 login_btn" onclick="check_form_register();"/>
	    					</span>	
	    				</li>	
	    			</ul>	
	    			</form>	
	    		</div>			</div>
    	</div>
    </div>
    <script type="text/javascript">
    function check_form_register()
    {
    	var exp = new RegExp("^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$", "i");
    	var flag = 0;
		if(!exp.test($("#registForm2 input[name='username']").val())){
			GGSHOP.msgBox.show('error', 'Your email is wrong!');
			return false;
		}else{
			$.ajax({
				type: "POST",
				url: "/auth-check",
				data: {email:$("#registForm2 input[name='username']").val()},
				async: false,
				success: function(data) {					
					switch(data) {					
						case "1":
							break;						
						default:							
							GGSHOP.msgBox.show('error','Your email has been registered!');
							flag = 1;							
					}
				}			
			});			
		}
		if (flag) {
			return 0 ;
		}

		if ($("#registForm2 input[name='userpass']").val() != $("#registForm2 input[name='confirm_userpass']").val()) {
			GGSHOP.msgBox.show('error','Your password was wrong!');
			return false;
		}

		if ($("#registForm2 input[name='userpass']").val() == '') {
			GGSHOP.msgBox.show('error','Your password was wrong!');
			return false;
		}
		$('#registForm2').submit();
    }  
    </script>